require "Common/define"
require "Logic/Config"
require "Common/functions"

RedDotsWorldMapSearchHandler = {};
local this = RedDotsWorldMapSearchHandler;
function RedDotsWorldMapSearchHandler.init()
    CloseEvent(Config.EventType.Fresh_WorldMapSearch, this.update)
    ListenEvent(Config.EventType.Fresh_WorldMapSearch, this.update)

    return this
end

--参数1： id，nil检查所有
function RedDotsWorldMapSearchHandler.getFlag(...)
    local msgId = ...
    local flag = Config.RedDotsFlagState.None 
    -- local open_chapter = dataTable.getDataTableByStringId("t_global", 330 ,"f_int_value")
    -- local cur_chapter = logicMgr.MapManager.GetMapcfgByID(MapManager.getMapId()).f_ChapterId or 1
    -- if cur_chapter >= open_chapter  and Config.OpenPlunder == true then  
    --     local ret1 = GetPlayerPrefs("uibigmap_click_world_map_search")
    --     local red1 = false
    --     if ret1 == nil or ret1 == "" then
    --         red1 = true
    --     end
    --     if red1 then
    --         flag = Config.RedDotsFlagState.Needful
    --     end
    -- end
    return flag
end

function RedDotsWorldMapSearchHandler.update()
    RedDotsManager.addBroadcast(Config.RedDotsType.WorldMapSearch)
end
